<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
$dbConfig = require(dirname(__FILE__).'/db_config.php');

return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'虫虫书吧',
	'timeZone'=>'Asia/Chongqing',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.util.*',
		'application.service.*',
		'application.components.*',
	),
	
	'modules'=>array(
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'1234',
		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
	),
	
	//'onBeginRequest'=>create_function('$event', 'return ob_start("ob_gzhandler");'),
	//'onEndRequest'=>create_function('$event', 'return ob_end_flush();'),

	// application components
	'components'=>array(
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
			'stateKeyPrefix'=>'HX',
			'loginUrl' => array('site/login'),
		),
		// uncomment the following to enable URLs in path-format
		'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false,
			'urlSuffix'=>'.html',
			'rules'=>array(
				'<controller:book>/<id:\d+>'=>'book/view',
				'<controller:book>/<action:editui>/<id:\d+>'=>'book/editui',
				'<controller:\w+>/<action:search>/<keyword:\w+>'=>'book/search',
				'<controller:class>/<id_page:\w+>'=>'book/category',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),

		'errorHandler'=>array(
			'errorAction' => 'site/error',
		 ),
		 
		'db' => $dbConfig['db'],
		 
		'smarty'=>array(
			'class'=>'application.extensions.CSmarty',
		),
		
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
	),

	// using Yii::app()->params['paramName']
    'params' => array_merge(
    	require(dirname(__FILE__).'/busi_config.php')
     ),
);
